﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<VietImage.Models.Category>" %>
<%@ Register Src="~/Views/Category/Category.ascx" TagName="category" TagPrefix="uc" %>


<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
<%
    int lang = (int)ViewData["Language"];
    String title = "Thư viện ảnh";
    if (Model.ID != 0)
        title = Model.GetDetail(lang).Name;
    %>
     <%= title %>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
 <%
     int lang = (int)ViewData["Language"];
 %>
   <div>

        <div id="direction" style="width:400px; float:left; padding-top:15px;">
            <div class="right-arrow"></div>
            <div style="font-size:14px; float:left;"><%= Html.ActionLink("THƯ VIỆN ẢNH","Index","Category") %></div>
<% 
    if (Model.ID != 0)
    {
        if (Model.Parents != null && Model.Parents[0] != null)
        {
%>
            <div class="right-arrow"></div>
            <div style="font-size:14px; float:left;"><%= Html.ActionLink(Model.Parents[0].GetDetail(lang).Name, "Index", "Category", new { id = Model.Parents[0].ID }, null)%></div>
<%            
        }
        if (Model.ID != 0)
        {
%>
            <div class="right-arrow"></div>
            <div style="font-size:14px; float:left;"><%= Html.ActionLink(Model.GetDetail(lang).Name, "Index", "Category", new { id = Model.ID }, null)%></div>
<%
        }
    }
%>
        </div>
        <div id="searchTool" style="width:600px; float:right;">
            <table border="0" cellspacing="5" cellpadding="5" style="float:right;">
                <tr>
                    <td>
                        <table cellpadding="0" cellspacing="0" border="0">
	                        <tr class="tr-textbox">    
    	                        <td class="left-textbox"></td>
                                <td class="center-textbox"><input value="Từ khóa ..." size="40" onfocus="textboxsearchonfocus(this);" onblur="textboxsearchonblur(this);" name="txtSearch" type="text" class="search-textbox"/></td>
    	                        <td class="right-textbox"></td>    
                            </tr>
                        </table>
                    </td>
                    <td>
                        <div style="cursor:pointer;" onmouseout="buttonmouseout('Search');" onmousedown="buttonmousedown('Search');" onmouseover="buttonmouseover('Search');"><table cellpadding="0" cellspacing="0" border="0">
                            <tr>
                                <td id="lbtnSearch" class="left-button"></td>
                                <td id="mbtnSearch" class="middle-button"><span style="color:White;">TÌM KIẾM</span></td>
                                <td id="rbtnSearch" class="right-button"></td>                        
                            </tr>          
                        </table></div>                    
                    </td>
                    <td class="horizontalborder-twoline"></td>
                    <td style="font-size:14px"><div style="cursor:pointer"><i><%=Html.ActionLink("Tìm kiếm nâng cao", "Index", "Search") %></i></div></td>
                </tr>
            </table>
        
        </div>
    </div>

    <div id="listCategories" style="clear:both; width:1000px; position:relative; left:50%; margin-left:-500px; padding-top:5px; ">
            
            <div class="scrollbar2" style="width:1000px;">

                <div class="scrollbar"><div class="track"><div class="thumb"><div class="end"></div></div></div></div>

<% 
    int count = 0;
    List<VietImage.Models.Category> lst = Model.Children;
    if (lst != null)
    {
        count = lst.Count;
    }
    else
    {
        lst = VietImage.Models.Category.GetListAvailableParentCategories();
        if (lst != null)
        {
            count = lst.Count;
        }
        else
        {
            lst = new List<VietImage.Models.Category>();
        }
    }
    Double h = ((Double)count / 2) + 0.5;
    int itemwidth = 200;
    int half = (int)h;
    //half = 15;
%>
                <div class="viewport" style="width:1000px; height:500px; margin-top:50px;"><div class="overview" style="<%= "width:" + half * itemwidth + "px;" %>">
<%
    for (int i = 0; i < count; )
    {
        cat1.ViewData["Category"] = lst[i++];
%>
                    <div style="float:left;">
                    <uc:category ID="cat1" runat="server" />
<%
        if (i < count)
        {
            cat2.ViewData["Category"] = lst[i++];
%>
                    <uc:category ID="cat2" runat="server" />
<%
        } 
%>
                    </div>
<%
    }
%>

                </div></div>

            </div>
    </div>
</asp:Content>
